<!DOCTYPE html>
<html>
<head>
    <meta name="layout" content="main"/>
    <g:set var="entityName" value="${message(code: 'contactSurvey.label', default: 'contactSurvey')}"/>
    <title>新增客户</title>
    <style>
        i.fa.fa-chevron-down::before{
            display: none;
        }
        i.fa.fa-chevron-up::before{
            display: none;
        }
    </style>
</head>

<body>
<div class="small-header">
    <div class="hpanel">
        <div class="panel-body">
            <div id="hbreadcrumb" class="pull-right">
                <ol class="hbreadcrumb breadcrumb">
                    <li>PLS CINDATA</li>
                    <li>
                        <g:link controller="menu" action="index">CINDATA</g:link>
                    </li>
                    <li class="active">
                        <span>新增客户</span>
                    </li>
                </ol>
            </div>

            <h2 class="font-light m-b-xs">
                新增客户
            </h2>
        </div>
    </div>
</div>


    <g:if test="${flash.message}">
        <div class="message alert alert-info" role="status">${flash.message}</div>
    </g:if>
    <g:hasErrors bean="${this.menu}">
        <ul class="errors" role="alert">
            <g:eachError bean="${this.menu}" var="error">
                <li <g:if test="${error in org.springframework.validation.FieldError}">data-field-id="${error.field}"</g:if>><g:message
                        error="${error}"/></li>
            </g:eachError>
        </ul>
    </g:hasErrors>


    <div class="content animate-panel">
        <div class="row">
            <div class="hpanel hblue">
                <div class="panel-heading">
                    新增客户
                </div>

                <div class="panel-body form-horizontal">

                    <div class="panel-heading">
                         1、申请概况
                    </div>
                    <div class="panel-heading">
                         （一）借款人及配偶基本申请信息
                    </div>
                    <g:form action="borrowerSave">
                        <div class="form-group">
                            <label class="col-md-2 control-label is-required">借款人1:</label>
                            <div class="col-md-3">
                                <g:textField class="form-control" type="text" name="fullName" value="${this.contactSurvey?.fullName}"/>
                            </div>
                            <label class="col-md-2 control-label is-required">性别:</label>
                            <div class="col-md-2">
                                <div class="radio radio-info radio-inline">
                                    <g:radio name="sex" value="男" checked="${contactSurvey?.sex == '男'}" id="sex1"/>
                                    <label for="sex1">男</label>
                                </div>
                                <div class="radio radio-info radio-inline ">
                                    <g:radio name="sex" value="女" checked="${contactSurvey?.sex == '男'}" id="sex2"/>
                                    <label for="sex2">女</label>
                                </div>
                            </div>
                            <input type="hidden" name="sexA" id="sexA">
                            <input type="hidden" name="birthday" id="birthday">
                            <label class="col-md-1 control-label is-required">年龄:</label>
                            <div class="col-md-2">
                                <input type="text" class="form-control" name="age"  placeholder="自动显示" style="width: 90px" id="age" value="<g:if test='${contactSurvey?.birthday}'>${(new Date()).getYear() .minus(contactSurvey?.birthday?.getYear())}</g:if>">
                            </div>
                        </div>

                        <div class="form-group">

                            <div class="col-md-1 col-md-offset-1">
                                <label class="is-required" style="position: absolute;left: 3%;"></label>
                                <g:select class=" form-control" name="identityType" id="identityType"
                                          optionKey="id" optionValue="name"
                                          from="${com.cindata.dictionary.ContactIdentityType.list()}"
                                          value="${this.contactSurvey?.identityType}"
                                />
                            </div>
                            <div class="col-md-3">
                                <g:textField class="form-control" type="text" name="idNumber" id="idNumber" value="${this.contactSurvey?.idNumber}"/>
                            </div>
                            <label class="col-md-2 control-label is-required">户口性质:</label>
                            <div class="col-md-3">
                                <g:each in="${com.cindata.dictionary.AccountNatureDict.list()}">
                                    <div class="radio radio-info radio-inline ">
                                        <input type="radio" name="accountNature" value="${it?.code}" checked="true">
                                        <label>${it?.name}</label>
                                    </div>
                                </g:each>
                            </div>
                        </div>

                        <div class="form-group ">
                            <label class="col-md-2 control-label is-required" >移动电话:</label>
                            <div class="col-md-3" >
                                <input type="text" class="form-control" name="cellphone" id="cellphone" value="${this.contactSurvey?.cellphone}" >
                            </div>
                            <label class="col-md-2 control-label is-required" >住宅电话:</label>
                            <div class="col-md-3" >
                                <input type="text" class="form-control" name="phone" id="phone" value="${this.contactSurvey?.phone}" >
                            </div>
                        </div>

                        <div class="form-group ">
                            <label class="col-md-2 control-label is-required" >每月收入:</label>
                            <div class="col-md-3" >
                                <div class="input-group m-b">
                                    <g:textField class="form-control" type="text" name="monthlyIncome" value="${this.contactSurvey?.monthlyIncome}"/>
                                    <span class="input-group-addon">元</span>
                                </div>
                            </div>
                            <label class="col-md-2 control-label is-required" >邮编:</label>
                            <div class="col-md-3" >
                                <input type="text" class="form-control" name="zipCode" id="zipCode" value="${this.contactSurvey?.zipCode}" >
                            </div>
                        </div>

                        <div class="form-group ">
                            <label class="col-md-2 control-label is-required" >家庭通讯地址:</label>
                            <div class="col-md-8" >
                                <input type="text" class="form-control" name="address" id="address" value="${this.contactSurvey?.address}" >
                            </div>

                        </div>

                        <div class="form-group ">
                            <label class="col-md-2 control-label is-required" >工作单位:</label>
                            <div class="col-md-8" >
                                <input type="text" class="form-control" name="workUnitName" id="workUnitName" value="${this.contactSurvey?.workUnitName}" >
                            </div>
                        </div>

                        <div class="form-group ">
                            <label class="col-md-2 control-label is-required" >工作通讯地址:</label>
                            <div class="col-md-8" >
                                <input type="text" class="form-control" name="workUnitAddress" id="workUnitAddress" value="${this.contactSurvey?.workUnitAddress}" >
                            </div>
                        </div>

                        <div class="form-group ">
                            <label class="col-md-2 control-label is-required">婚姻状况:</label>
                            <div class="col-md-1">
                                <g:select class="form-control m-b" name="maritalStatus" id="maritalStatus"
                                          from="${["已婚","未婚","再婚", "离异", "丧偶"]}"
                                          value="${this.contactSurvey?.maritalStatus}"
                                />
                            </div>
                            <div id="maritalInfo">
                                <label class="col-md-1 control-label is-required" >配偶:</label>
                                <div class="col-md-1">
                                    <input type="text" class="form-control" name="spouseFullName" id="spouse" value="${this.contactSurvey?.spouseFullName}" >
                                </div>
                                <label class="col-md-1 control-label is-required" >移动电话:</label>
                                <div class="col-md-1" >
                                    <input type="text" class="form-control" name="spouseCellphone" id="spousePhone" value="${this.contactSurvey?.spouseCellphone}" >
                                </div>
                                <label class="control-label is-required" style="position: absolute;left: 66.8%"></label>
                                <div class="col-md-1 col-md-offset-1" >
                                    <g:select class="form-control" name="spouseIdentityType" id="spouseIdentityType"
                                              optionKey="id" optionValue="name"
                                              from="${com.cindata.dictionary.ContactIdentityType.list()}"
                                              value="${this.contactSurvey?.identityType}"
                                    />
                                </div>
                                <div class="col-md-1">
                                    <g:textField class="form-control" type="text" name="spouseIdNumber" id="spouseIdNumber" value="${this.contactSurvey?.spouseIdNumber}"/>
                                </div>
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="col-md-3 col-md-offset-6">
                                <g:submitButton class="btn btn-info" name="create" value="保存"/>
                            </div>
                        </div>
                    </g:form>
                </div>
            </div>
        </div>


        <div class="row" id="second">
            <div class="hpanel hblue">
                <div class="panel-heading">
                    <a class="showhide"><i class="fa fa-chevron-up"> <input type="button" value="添加借款人2" class="btn btn-info" ></i></a>
                </div>

                <div class="panel-body form-horizontal">
                    <g:form action="borrowerSave2">
                        <input type="hidden" name="reportId" value="${this.contactSurveyReport?.id}" />
                        <input type="hidden" name="contactId" value="${this.contactSurvey?.id}" />
                        <div class="form-group">
                            <label class="col-md-2 control-label is-required">借款人2:</label>
                            <div class="col-md-3">
                                <g:textField class="form-control" type="text" name="fullName" id="fullName2" value="${this.contactSurvey2?.fullName}"/>
                            </div>
                            <label class="col-md-2 control-label is-required">性别:</label>
                            <div class="col-md-2">
                                <div class="radio radio-info radio-inline">
                                    <g:radio name="sex" value="男" checked="${contactSurvey2?.sex == '男'}" id="sex3"/>
                                    <label for="sex3">男</label>
                                </div>
                                <div class="radio radio-info radio-inline ">
                                    <g:radio name="sex" value="女" checked="${contactSurvey2?.sex == '女'}" id="sex4"/>
                                    <label for="sex4">女</label>
                                </div>
                            </div>
                            <input type="hidden" name="sexA" id="sexB">
                            <input type="hidden" name="birthday" id="birthday2">
                            <label class="col-md-1 control-label is-required">年龄:</label>
                            <div class="col-md-2">
                                <input type="text" class="form-control" name="age"  placeholder="自动显示" style="width: 90px" id="age2" value="<g:if test='${contactSurvey2?.birthday}'>${(new Date()).getYear() .minus(contactSurvey2?.birthday?.getYear())}</g:if>">
                            </div>
                        </div>

                        <div class="form-group">

                            <div class="col-md-1 col-md-offset-1">
                                <label class="is-required" style="position: absolute;left: 3%;"></label>
                                <g:select class=" form-control" name="identityType" id="identityType2"
                                          optionKey="id" optionValue="name"
                                          from="${com.cindata.dictionary.ContactIdentityType.list()}"
                                          value="${this.contactSurvey2?.identityType}"
                                />
                            </div>
                            <div class="col-md-3">
                                <g:textField class="form-control" type="text" name="idNumber" id="idNumber2" value="${this.contactSurvey2?.idNumber}"/>
                            </div>
                            <label class="col-md-2 control-label is-required">户口性质:</label>
                            <div class="col-md-3">
                                <g:each in="${com.cindata.dictionary.AccountNatureDict.list()}">
                                    <div class="radio radio-info radio-inline ">
                                        <input type="radio" name="accountNature" value="${it?.code}" checked="true">
                                        <label>${it?.name}</label>
                                    </div>
                                </g:each>
                            </div>
                        </div>

                        <div class="form-group ">
                            <label class="col-md-2 control-label is-required" >移动电话:</label>
                            <div class="col-md-3" >
                                <input type="text" class="form-control" name="cellphone" value="${this.contactSurvey2?.cellphone}" >
                            </div>
                            <label class="col-md-2 control-label is-required" >住宅电话:</label>
                            <div class="col-md-3" >
                                <input type="text" class="form-control" name="phone" value="${this.contactSurvey2?.phone}" >
                            </div>
                        </div>

                        <div class="form-group ">
                            <label class="col-md-2 control-label is-required" >每月收入:</label>
                            <div class="col-md-3" >
                                <div class="input-group m-b">
                                    <g:textField class="form-control" type="text" name="monthlyIncome" value="${this.contactSurvey2?.monthlyIncome}"/>
                                    <span class="input-group-addon">元</span>
                                </div>
                            </div>
                            <label class="col-md-2 control-label is-required" >邮编:</label>
                            <div class="col-md-3" >
                                <input type="text" class="form-control" name="zipCode"  value="${this.contactSurvey2?.zipCode}" >
                            </div>
                        </div>

                        <div class="form-group ">
                            <label class="col-md-2 control-label is-required" >家庭通讯地址:</label>
                            <div class="col-md-8" >
                                <input type="text" class="form-control" name="address"  value="${this.contactSurvey2?.address}" >
                            </div>

                        </div>

                        <div class="form-group ">
                            <label class="col-md-2 control-label is-required" >工作单位:</label>
                            <div class="col-md-8" >
                                <input type="text" class="form-control" name="workUnitName" value="${this.contactSurvey2?.workUnitName}" >
                            </div>
                        </div>

                        <div class="form-group ">
                            <label class="col-md-2 control-label is-required" >工作通讯地址:</label>
                            <div class="col-md-8" >
                                <input type="text" class="form-control" name="workUnitAddress" value="${this.contactSurvey2?.workUnitAddress}" >
                            </div>
                        </div>

                        <div class="form-group ">
                            <label class="col-md-2 control-label is-required">婚姻状况:</label>
                            <div class="col-md-1">
                                <g:select class="form-control m-b" name="maritalStatus" id="maritalStatus2"
                                          from="${["已婚","未婚","再婚", "离异", "丧偶"]}"
                                          value="${this.contactSurvey2?.maritalStatus}"
                                         />
                            </div>
                            <div id="maritalInfo2">
                                <label class="col-md-1 control-label is-required" >配偶:</label>
                                <div class="col-md-1">
                                    <input type="text" class="form-control" name="spouseFullName" id="spouse2" value="${this.contactSurvey2?.spouseFullName}" >
                                </div>
                                <label class="col-md-1 control-label is-required" >移动电话:</label>
                                <div class="col-md-1" >
                                    <input type="text" class="form-control" name="spouseCellphone" id="spousePhone2" value="${this.contactSurvey2?.spouseCellphone}" >
                                </div>
                                <label class="control-label is-required" style="position: absolute;left: 66.8%"></label>
                                <div class="col-md-1 col-md-offset-1" >
                                    <g:select class="form-control" name="spouseIdentityType" id="spouseIdentityType2"
                                              optionKey="id" optionValue="name"
                                              from="${com.cindata.dictionary.ContactIdentityType.list()}"
                                              value="${this.contactSurvey2?.identityType}"
                                    />
                                </div>
                                <div class="col-md-1">
                                    <g:textField class="form-control" type="text" name="spouseIdNumber" id="spouseIdNumber2" value="${this.contactSurvey2?.spouseIdNumber}"/>
                                </div>
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="col-md-3 col-md-offset-6">
                                <g:submitButton class="btn btn-info" name="create" value="保存"/>
                            </div>
                        </div>
                    </g:form>
                </div>
            </div>
        </div>

        <div class="row">
            <div class="hpanel hblue">
                <div class="panel-body form-horizontal">
                    <div class="panel-heading">
                        （二）贷款（授信）申请概要
                    </div>
                    <g:form action="createClientCreditStatus">
                        <input type="hidden" name="reportId" value="${this.contactSurveyReport?.id}">
                        <input type="hidden" name="contactId" value="${this.contactSurvey?.id}">
                        <input type="hidden" name="contactId2" value="${this.contactSurvey2?.id}">
                        <div class="form-group">
                            <label class="col-md-2 control-label is-required">贷款金额:</label>
                            <div class="col-md-3">
                                <div class="input-group m-b">
                                    <g:textField class="form-control" type="text" name="loansAmount" id="loansAmount" value="${this.contactSurveyReport?.loansAmount}"/>
                                    <span class="input-group-addon">元</span>
                                </div>
                            </div>
                            <label class="col-md-2 control-label is-required">可贷金额:</label>
                            <div class="col-md-3">
                                <div class="input-group m-b">
                                    <g:textField class="form-control" type="text" name="acceptableLoansAmount" id="acceptableLoansAmount" value="${this.contactSurveyReport?.acceptableLoansAmount}"/>
                                    <span class="input-group-addon">元</span>
                                </div>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-md-2 control-label is-required">申请日期:</label>
                            <div class="col-md-3 datePicker">
                                <div class="input-daterange input-group p-r-n">
                                    <input type="text" class="form-control datepicker1" placeholder="请填申请日期"
                                           value="${this.contactSurveyReport?.applicationDate}" name="applicationDate" style="text-align: left" id="applicationDate"/>
                                </div>
                            </div>
                            <label class="col-md-2 control-label is-required">借款年限:</label>
                            <div class="col-md-3">
                                <div class="input-group m-b">
                                    <g:textField class="form-control" type="text" name="loansDuration" id="loansDuration" value="${this.contactSurveyReport?.loansDuration}"/>
                                    <span class="input-group-addon">年</span>
                                </div>
                            </div>
                        </div>

                        <div class="form-group ">
                            <label class="col-md-2 control-label is-required">是否组合贷款:</label>
                            <div class="col-md-3">
                                <div class="radio radio-info radio-inline ">
                                    <g:radio name="isCombinationLoans" value="true" checked="${contactSurveyReport?.isCombinationLoans == true}"/>
                                    <label >是</label>
                                </div>
                                <div class="radio radio-info radio-inline ">
                                    <g:radio name="isCombinationLoans"  value="false" checked="${contactSurveyReport?.isCombinationLoans ==false}"/>
                                    <label >否</label>
                                </div>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-md-2 control-label is-required">公积金月还款额:</label>
                            <div class="col-md-3">
                                <div class="input-group m-b">
                                    <g:textField class="form-control" type="text" name="depositBaseOnCurrent" id="depositBaseOnCurrent" value="${this.contactSurveyReport?.depositBaseOnCurrent}"/>
                                    <span class="input-group-addon">元</span>
                                </div>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-md-2 control-label is-required">月总还款额:</label>
                            <div class="col-md-3">
                                <div class="input-group m-b">
                                    <g:textField class="form-control" type="text" name="depositAmountOnCurrent" id="depositAmountOnCurrent" value="${this.contactSurveyReport?.depositAmountOnCurrent}"/>
                                    <span class="input-group-addon">元</span>
                                </div>
                            </div>

                        </div>


                        <div class="form-group ">
                            <label class="col-md-2 control-label is-required">还款方式:</label>
                            <div class="col-md-3">
                                <g:each in="${com.cindata.dictionary.RepaymentModeDict.list()}">
                                    <div class="radio radio-info radio-inline ">
                                        <input type="radio" name="starRepaymentMode" value="${it?.code}" >
                                        <label>${it?.name}</label>
                                    </div>
                                </g:each>
                            </div>
                            <label class="col-md-2 control-label is-required">放款方式:</label>
                            <div class="col-md-3">
                                <g:each in="${com.cindata.dictionary.LoanMethodDict.list()}">
                                    <div class="radio radio-info radio-inline ">
                                        <input type="radio" name="loanMethod" value="${it?.code}" >
                                        <label>${it?.name}</label>
                                    </div>
                                </g:each>
                            </div>
                        </div>

                        <div class="form-group ">
                            <label class="col-md-2 control-label is-required" >提前放款担保机构:</label>
                            <div class="col-md-8" >
                                <input type="text" class="form-control" name="guaranteeInstitution" value="${this.contactSurveyReport?.guaranteeInstitution}" >
                            </div>
                        </div>

                        <div class="form-group ">

                            <label class="col-md-2 control-label is-required" >受理人:</label>
                            <div class="col-md-3" >
                                <input type="text" class="form-control" name="loanRecipient"  value="${this.contactSurveyReport?.loanRecipient}" >
                            </div>
                        </div>

                        %{--字段太多，小屏不适配--}%
                        <div class="form-group">
                            <label class="col-md-2 control-label is-required" >提前放款环节:</label>
                            <div class="col-md-6">
                                <div class="radio radio-info radio-inline ">
                                    <input type="radio" name="advanceLoanStage" value="抵押回执环节" >
                                    <label for="sex1">抵押回执环节</label>
                                </div>
                                <div class="radio radio-info radio-inline ">
                                    <input type="radio" name="advanceLoanStage" value="房产证完税环节" >
                                    <label for="sex2">房产证完税环节</label>
                                </div>
                                <div class="radio radio-info radio-inline ">
                                    <input type="radio" name="advanceLoanStage" value="房产证（新证）环节" >
                                    <label for="sex1">房产证（新证）环节</label>
                                </div>
                                <div class="radio radio-info radio-inline ">
                                    <input type="radio" name="advanceLoanStage" value="其他">
                                    <label for="sex2">其他</label>
                                </div>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-md-2 control-label is-required" >供楼账号:</label>
                            <div class="col-md-3" >
                                <input type="text" class="form-control" name="housingLoansAccount"  value="${this.contactSurveyReport?.housingLoansAccount}" >
                            </div>
                            <label class="col-md-2 control-label is-required" >放款银行:</label>
                            <div class="col-md-3" >
                                <input type="text" class="form-control" name="loansBank"  value="${this.contactSurveyReport?.loansBank}" >
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="col-md-3 col-md-offset-6">
                                <g:submitButton class="btn btn-info" name="create3" value="下一步"/>
                                <button type="button" class="btn cancelButton" style="margin-left: 20px;">取消</button>
                            </div>
                        </div>
                    </g:form>
                </div>
            </div>
        </div>



    </div>
<g:javascript>
    $(function () {
        $("#idNumber").blur(function(){
            var idNumber=$("#idNumber").val()
            var errorMessage="请输入正确的身份证号码"

            var idNumCheck=verifiedIdNumber(idNumber,errorMessage)
            if(idNumCheck){
                var idNumberSpilt=idNumSub(idNumber)
                console.log("idNumberSpilt:  "+idNumberSpilt)
                var data=idNumberSpilt.split(",")
                $("#birthday ").val(data[0])
                $("#sexA").val(data[1])
                $("#age").val(data[2])
            }
        });
        $("#idNumber2").blur(function(){
            var idNumber=$("#idNumber2").val()
            var errorMessage="请输入正确的身份证号码"

            var idNumCheck=verifiedIdNumber(idNumber,errorMessage)
            if(idNumCheck){
                var idNumberSpilt=idNumSub(idNumber)
                console.log("idNumberSpilt:  "+idNumberSpilt)
                var data=idNumberSpilt.split(",")
                $("#birthday2 ").val(data[0])
                $("#sexB").val(data[1])
                $("#age2").val(data[2])
            }
        });
        function verifiedIdNumber(idNum, errorMessage) {
            var city = {11: "北京", 12: "天津", 13: "河北", 14: "山西", 15: "内蒙古", 21: "辽宁", 22: "吉林", 23: "黑龙江 ", 31: "上海",
                32: "江苏", 33: "浙江", 34: "安徽", 35: "福建", 36: "江西", 37: "山东", 41: "河南", 42: "湖北 ", 43: "湖南", 44: "广东",
                45: "广西", 46: "海南", 50: "重庆", 51: "四川", 52: "贵州", 53: "云南", 54: "西藏 ", 61: "陕西", 62: "甘肃", 63: "青海",
                64: "宁夏", 65: "新疆", 71: "台湾", 81: "香港", 82: "澳门", 91: "国外 "};

            if (!(/^(\d{15}$|^\d{18}$|^\d{17}(\d|X|x))$/.test(idNum))) {
                alert(errorMessage)
                // $(".helpMsg").text(errorMessage).fadeIn(200);
                // timeOut();
                return false;
            } else if (!city[idNum.substr(0, 2)]) {
                // $(".helpMsg").text(errorMessage).fadeIn(200);
                // timeOut();
                alert(errorMessage)
                return false;
            } else {
                //18位身份证需要验证最后一位校验位
                if (idNum.length == 18) {
                    idNum = idNum.split('');
                    //加权因子
                    var factor = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2];
                    //校验位
                    var parity = [1, 0, 'X', 9, 8, 7, 6, 5, 4, 3, 2];
                    var sum = 0;
                    var ai = 0;
                    var wi = 0;
                    for (var i = 0; i < 17; i++) {
                        ai = idNum[i];
                        wi = factor[i];
                        sum += ai * wi;
                    }
                    var index = sum % 11;
                    if (index == 2 && idNum[17] != 'x' && idNum[17] != 'X')
                    {
                        // $(".helpMsg").text(errorMessage).fadeIn(200);
                        // timeOut();
                        alert(errorMessage)
                        return false;
                    }
                    if (index != 2 && parity[sum % 11] != idNum[17]) {
                        // $(".helpMsg").text(errorMessage).fadeIn(200);
                        // timeOut();
                        alert(errorMessage)
                        return false;
                    }
                }
            }
            return true;
        }

        function idNumSub(idNumber){
            var birth
            var sex
            var age
            birth=idNumber.substring(6, 10) + "-" + idNumber.substring(10, 12) + "-" + idNumber.substring(12, 14);
            if (parseInt(idNumber.substr(16, 1)) % 2 == 1) {
                sex="男";
            } else {
                sex="女";
            }
            var myDate = new Date();
            var month = myDate.getMonth() + 1;
            var day = myDate.getDate();
            age = myDate.getFullYear() - idNumber.substring(6, 10) - 1;
            if (idNumber.substring(10, 12) < month || idNumber.substring(10, 12) == month && idNumber.substring(12, 14) <= day) {
                age++;
            }
            return birth+","+sex+","+age;
        }

        $('.datepicker1').datepicker({
            language: 'zh-CN',
            format:"yyyy-mm-dd"
        });
        $('.input-group.date').datepicker({ });
        $('.input-daterange').datepicker({ });


        var maritalStatus=$("#maritalStatus")
        var maritalStatus2=$("#maritalStatus2")
        var maritalInfo=$("#maritalInfo")
        var maritalInfo2=$("#maritalInfo2")

        maritalInfo.hide();
        maritalInfo2.hide();
        if (maritalStatus.val() == "已婚" || maritalStatus.val() == "再婚") {
            maritalInfo.show();
        }
        maritalStatus.change(function () {
            if (maritalStatus.val() == "未婚" || maritalStatus.val() == "离异" || maritalStatus.val() == "丧偶") {
                maritalInfo.hide();
            }
            if (maritalStatus.val() == "已婚" || maritalStatus.val() == "再婚") {
                maritalInfo.show();
            }
        });

        if (maritalStatus2.val() == "已婚" || maritalStatus2.val() == "再婚") {
            maritalInfo2.show();
        }
        maritalStatus2.change(function () {
            if (maritalStatus2.val() == "未婚" || maritalStatus2.val() == "离异" || maritalStatus2.val() == "丧偶") {
                maritalInfo2.hide();
            }
            if (maritalStatus2.val() == "已婚" || maritalStatus2.val() == "再婚") {
                maritalInfo2.show();
            }
        });


    });
</g:javascript>
</body>
</html>
